<extend name="Public/base" />

<block name="body">
    <div class="main-title location">
        <h2>
        <i>当前位置：</i>扩展管理 - 插件列表
        </h2>
    </div>
    <div class="title_form">
        <div class="title_search">
            <a href="{:U('create')}"><button class="pull-right">快速创建</button></a>
            <form class="form-search form-inline" action="{:U('')}" method="get">
                <label for="">标识：</label>
                <input type="text" name="name" class="text-s" value="{:I('name')}">
                <button type="submit">搜索</button>
            </form>
        </div>
    </div>
    <div class="typecho-table-wrap">
        <form action="{:U('del')}" method="post" id="del_form">
            <table id="del_table" class="table table-hover">
                <thead>
                <tr>
                    <th>名称</th>
                    <th>标识</th>
                    <th>描述</th>
                    <th>状态</th>
                    <th>作者</th>
                    <th>版本</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <volist name="list" id="vo">
                    <tr>
                        <td>{$vo.title}</td>
                        <td>{$vo.name}</td>
                        <td>
                            <present name="vo.id">
                                <a href="javascript:;" class="editable" data-name="description" data-type="text" data-pk="{$vo.id}" data-url="{:U('ajaxUpdate')}">{$vo.description}</a>
                            <else />
                                {$vo.description}
                            </present>
                        </td>
                        <td>{$vo.status_text|default="未安装"}</td>
                        <td>{$vo.author}</td>
                        <td>{$vo.version}</td>
                        <td>
                    <empty name="vo.uninstall">
                        <?php
                        $class	= get_addon_class($vo['name']);
                        if(!class_exists($class)){
                            $has_config = 0;
                        }else{
                            $addon = new $class();
                            $has_config = count($addon->getConfig());
                        }
                        ?>
                        <?php if ($has_config): ?>
                        <a href="{:U('config',array('id'=>$vo['id']))}">设置</a>
                        <?php endif ?>
                        <?php if ($vo['status'] >= 0): ?>
                        <eq name="vo.status" value="0">
                        <a class="ajax-get" href="{:U('enable',array('id'=>$vo['id']))}">启用</a>
                        <else />
                        <a class="ajax-get" href="{:U('disable',array('id'=>$vo['id']))}">禁用</a>
                        </eq>
                        <?php endif ?>
                        {// <eq name="vo.author" value="thinkphp">}
                        <a class="ajax-get" href="{:U('uninstall?id='.$vo['id'])}">卸载</a>
                        {// </eq>}
                        <else />
                        <a class="ajax-get" href="{:U('install?addon_name='.$vo['name'])}">安装</a>
                    </empty>
                    </td>
                    </tr>
                </volist>
                </tbody>
            </table>
        </form>
    </div>
    <div class="pagination pagination-right">
        <button class="pull-left" id="batch_del">删除</button>
        {$_page}
    </div>
</block>
